// pages/convert/convert.js
Page({
    data: {
        btnLoading: false,
        zhText: '',
        yjText: '',
    },

    onLoad(options) {
        this.getYonjin();
    },
    getYonjin() {
        this.request({
            url: 'user/money/msg',
        }).then(res => {
            console.log('yongjin', res);
            this.setData({
                yjText: res.data.yj,
            });
        });
    },
    onInput(e) {
        this.setData({
            zhText: e.detail.value,
        });
    },

    onConvert() {
        if (!this.data.zhText)
            return wx.showToast({
                title: '请输入转换数额',
                icon: 'none',
            });

        this.request({
            url: 'user/money/commission/toJf',
            method: 'POST',
            data: {
                money: this.data.zhText,
            },
        }).then(res => {
            // 转换成功、提示信息
            wx.showToast({
                title: res.msg,
            });
            this.setData({
                zhText: '',
            });
        });
    },
});
